#include "N76E003.h"
#include "SFR_Macro.h"
#include "Function_define.h"
#include "Common.h"
#include "Delay.h"

#define SET_P20UP  (P2S |= SET_BIT7)
#define CLR_P20UP  (P2S &= ~SET_BIT7)

void main(void)
{
    UINT8 key = 0xff;

    Set_All_GPIO_Quasi_Mode;

    P04_PushPull_Mode;
    SET_P20UP;

    P04 = 1;
    while(1) {
        key = (key << 1) | P20;
        if (key == 0x00) {
            key = 0xff;
            P04 = ~P04;
        }
        Timer0_Delay1ms(100);        
    }
}